package com.quantice.database;

import com.quantice.Constants.StrConst;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class SQLiteHelper extends SQLiteOpenHelper {

	public static int SQL_VERSION = 1;
	public static String BBDDQUANTICE = "BBDDQUANTICE";

	public SQLiteHelper(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("CREATE TABLE "+StrConst.ingresos+" (id TEXT PRIMARY KEY, fecha TEXT, cantidad TEXT)");
		db.execSQL("CREATE TABLE "+StrConst.gastos+" (id TEXT PRIMARY KEY, fecha TEXT, cantidad TEXT)");
//		db.execSQL("CREATE TABLE login (mobil TEXT,email TEXT,psw TEXT,nick TEXT)");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS "+StrConst.ingresos);
		db.execSQL("DROP TABLE IF EXISTS "+StrConst.gastos);
//		db.execSQL("DROP TABLE IF EXISTS login");

		db.execSQL("CREATE TABLE "+StrConst.ingresos+" (id TEXT PRIMARY KEY, fecha TEXT, cantidad TEXT)");
		db.execSQL("CREATE TABLE "+StrConst.gastos+" (id TEXT PRIMARY KEY, fecha TEXT, cantidad TEXT)");
//		db.execSQL("CREATE TABLE login (mobil TEXT,email TEXT,psw TEXT,nick TEXT)");
	}

}